#ifndef SHOOT_HPP
#define SHOOT_HPP
#include "djiMotor.h"
#include "pid.h"

// 定义状态枚举
typedef enum {
    SHOOT_IDLE,        // 空闲状态
    SHOOT_FIRE,        // 发射状态
    SHOOT_TRIGGERED,   // 光电触发状态
    SHOOT_RETURN       // 自动返回状态
} ShootState_t;

// 定义状态枚举
typedef enum {
    BALL_IDLE,         // 空闲状态
    BALL_FINISH,        // 完成状态
//持球状态
    BALL_TAKE,
    BALL_LOSE

} BallState_t;

// 光电传感器读取宏
#define IS_PHOTOELECTRIC_TRIGGERED() (HAL_GPIO_ReadPin(STOP_GPIO_Port, STOP_Pin) == GPIO_PIN_RESET)

class Shoot
{
public:
    Shoot();
    void shootThree(void);
    void shootStop(void);
    void shootBack(void);
    void shootStateMachine(void);
    void trigger_spin(void);
    float speed_5065;
    ShootState_t currentState;

  //==========================公共变量==========================
    volatile BallState_t ballStatus;//是否有球
    volatile uint32_t flag_thread;//接收传回的线程通知

private:

    //扳机2006
    static const float M2006_speed_PID[3];
    //电机速度pid结构体
    pid_type_def speed_pid;
    motor_measure_t *trigger_Motor;
    int16_t result;
    float speedSet;

    CAN_MotorFeedback_t *motor_5065[2];

};


#endif
